package com.skivingcloud.admin;

import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import com.skivingcloud.common.utils.ReturnT;
import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hushouquan
 */
@SpringBootApplication
@EnableDiscoveryClient
@EnableEncryptableProperties
@RestController
@MapperScan(basePackages = { "com.skivingcloud.**.mapper" })
@EnableCaching
@EnableKnife4j
public class AdminBootApplication{
    private final static Logger log = LoggerFactory.getLogger(AdminBootApplication.class);
    public static void main(String[] args) {
        SpringApplication.run(AdminBootApplication.class, args);
    }

    @GetMapping("helloWorld")
    public ReturnT<String> helloWorld(){
        return ReturnT.ok("Hello World!");
    }
    
    @RequestMapping("/")
    public String index(){
        return "index";
    }
    
    @Bean
    public CommandLineRunner run() {
        return args -> {
            // 在这里编写你的初始化逻辑,比如建表什么的
            log.info("Spring Boot 应用已经启动。");
        };
    }
}
